<?php
namespace Home\Controller;
use Think\Controller;

    class LoginController extends Controller
    {
           public function yzm()
           {
               /* echo '<pre>';
                dump($_SESSION);
                echo session('verif_code');*/
                echo '12345';
           }

           //验证码类
           public function vcode()
           {
            $config = array(
            'fontSize' => 20, // 验证码字体大小
            'length' =>    4, // 验证码位数
            'useNoise' => true, // 关闭验证码杂点
            );
            $Verify = new \Think\Verify($config);
            $Verify->entry();
          }

          //注册
          public function zhuce()
          {
               
                $_POST['time'] = date('Y-m-d H:i:s');
                 dump($_POST);
                $data =M('sh_user')->where(array('number'=>$_POST['number']))->select();
                if (!empty($data)) {
                    //提示该用户以被注册
                    echo '该用户已被注册';
                } else {
                    M('sh_user')->create();
                    if (M('sh_user')->add() > 0) {
                            echo '添加成功';
                    } else {
                        echo '添加失败';
                    }
                }

          }


          //登录验证
          public function denglu()
          {
             $data = M('sh_user')->where(array('number'=>$_POST['number'],'pwd'=>$_POST['pwd']))->select();
             if ($data != null) {
                session('name',$data[0]['number']);
                $this->assign('name',session('name'));
                $this->display('Index/index');
             }else{

             }

          }


          public function tuichu()
          {
                unset($_SESSION['name']);
                $this->display('Index/index');
                
          }

          public function hg()
          {
            echo 'aaa'.$_POST['a'].$_POST['b'];
          }
        
    }
